package systemFile;

import general.ActionEnum;
import org.apache.log4j.Logger;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

// Singleton
public class FileBuffer {

    private static Logger log = Logger.getLogger(FileBuffer.class);

    private static volatile FileBuffer instance = null;
    private Map<File, ActionEnum> listOfFile;

    {
        listOfFile = new HashMap<File, ActionEnum>();
    }

    public static FileBuffer getInstance() {
        try {
            if (instance == null) {
                synchronized (FileBuffer.class) {
                    if (instance == null) {
                        instance = new FileBuffer();
                    }
                }
            }
        } catch (Exception e) {
            log.error(e.getMessage());
        }
        return instance;
    }

    private FileBuffer() {
    }

    public Map<File, ActionEnum> getListOfFile() {
        return listOfFile;
    }
}
